<template>
  <div class=''>
    <!-- 面包屑 -->
    <el-breadcrumb separator="/" style="font-size: 12px">
      <el-breadcrumb-item :to="{ path: '/welcome' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片 -->
    <el-card style="margin-top:20px">
      <!-- 表格 -->
      <el-table border style="margin-top:15px" :data="rightsList">
        <el-table-column type="index" label="#"></el-table-column>
        <el-table-column prop="authName" label="权限名称"></el-table-column>
        <el-table-column prop="path" label="路径"></el-table-column>
        <el-table-column label="权限等级">
          <template slot-scope="scope">
            <el-tag :type="typeObj[scope.row.level]">
              {{ scope.row.level | rank }}</el-tag>
          </template>
        </el-table-column>

      </el-table>
    </el-card>

  </div>
</template>

<script>
export default {
  data() {
    return {
      rightsList: [],// 权限列表的数据
      typeObj: {
        0: "primary",
        1: "success",
        2: "warning"
      },
    };
  },
  created() {
    this.getRightsList()
  },
  methods: {
    // 渲染权限列表的
    async getRightsList() {
      const res = await this.$API.getRightsListApi()

      console.log("权限列表", res);
      this.rightsList = res
    }
  },
  components: {}
};
</script>

<style lang='scss'>
</style>
